package edu.uvic.TabViz.framework.primitives;

import java.io.Serializable;

public class Point3D implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -548897100768833740L;
	protected float x,y,z;
	
	public Point3D(float x, float y, float z) {
		super();
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	public Point3D() {
		this(0f,0f,0f);
	}
	
	public Point3D(Point3D point3D) {
		this(point3D.getX(),point3D.getY(),point3D.getZ());
	}
	
	public float[] getArray(){
		return new float[]{ x, y, z};
	}
	public void set(float[] cor){
		x= cor[0];
		y = cor[1];
		z = cor[2];
	}
	public void set(Point3D point3D){
		set(point3D.getX(),point3D.getY(),point3D.getZ());
	}
	public void set(float x, float y, float z){
		set(new float[] {x, y, z});
	}
	public float getX() {
		return x;
	}

	public void setX(float x) {
		this.x = x;
	}

	public float getY() {
		return y;
	}
	
	public Point3D get() {
		return this;
	}
	
	public void setY(float y) {
		this.y = y;
	}

	public float getZ() {
		return z;
	}

	public void setZ(float z) {
		this.z = z;
	}
	public String toString(){
		return ("("+x+","+y+","+z+")");
	}
	@Override
	public int hashCode() {
		return (int)(x+y+z);
	}
}
